//
//  FundRecordCell.swift
//  baihuiju
//
//  Created by 赵家彬 on 2018/6/14.
//  Copyright © 2018年 赵家彬. All rights reserved.
//

import UIKit

class FundRecordCell: UITableViewCell {

    @IBOutlet weak var lblType: UILabel!
    
    @IBOutlet weak var lblTime: UILabel!
    
    @IBOutlet weak var lblMoney: UILabel!
    
    @IBOutlet weak var lblStatus: UILabel!
    
    @IBOutlet weak var lblBank: UILabel!
    
    @IBOutlet weak var lblRemark: UILabel!
    
    
    override func awakeFromNib() {
        super.awakeFromNib()
        self.selectionStyle = .none
    }

    var model:FundRecordModel = FundRecordModel() {
        didSet {
            //类型
            if model.type == "1" {
                lblType.backgroundColor = UIColor(hex:0x1e9fff)
            } else if model.type == "2" {
                lblType.backgroundColor = UIColor(hex:0x264056)
            } else if model.type == "3" {
                lblType.backgroundColor = UIColor(hex:0x5fb878)
            } else if model.type == "4" {
                lblType.backgroundColor = UIColor(hex:0xffb800)
            }
            lblType.text = "   \(model.fund_type)   "
            //时间
            lblTime.text = model.add_time
            
            //金额
            if Double(model.money) ?? 0.0 >= 0.0 {
                lblMoney.textColor = UIColor(hex:0xff6600)
                lblMoney.text = "+\(model.money)"
            } else {
                lblMoney.textColor = UIColor(hex:0x3276e6)
                lblMoney.text = model.money
            }
            
            //状态
            if model.status == "0" {
                lblStatus.textColor = UIColor(hex:0x4fb46e)
            } else if model.status == "1" {
                lblStatus.textColor = .black
            } else {
                lblStatus.textColor = .red
            }
            lblStatus.text = model.status_text
            
            lblBank.text = model.bank
            lblRemark.text = model.remark.isEmpty ? "" : "备注：\(model.remark)"
        }
    }
    
}
